home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / comm / cs_mac06.zip / ACTION.MAC next >
Text File  |  1992-08-23  |  10KB  |  223 lines

  1.  
  2.  ┌────────────────────────────────┐
  3.  │  Chuck Seyboldt's COMMO Macro  │   CS-MAC06:ACTION.MAC
  4.  └────────────────────────────────┘
  5.  
  6.     ┌──────────────────────────────────┐
  7. ┌───┤  COMMO "ACTION processor" macro  ├───
  8.     └──────────────────────────────────┘
  9.  
  10.   *  ACTION.MAC reads simple ASCII files and sends commands and
  11.   *  strings to the BBS based on the ACTION file.  Setup for PCBoards.
  12.  
  13.   *  You may make an ACTION file manually with a text editor.
  14.   *  An ACTION file generator is included later as the :alf macro command.
  15.   *  Located in the COMMO home dir, the ACTION file has this sort of format:
  16.  
  17. ┌───────────────────────────────  action.nl  ─┐
  18. │ u                                           │ < "U" for upload
  19. │ filename.ul                                 │ < Name the file to u/l
  20. │ A line of file desription.  Up to 45 chars  │ < decription
  21. │ in length.  Multiple line descriptions are  │
  22. │ supported if your BBS host allows them.     │
  23. │ --                                          │ < "--" to end ACTION item
  24. │ d                                           │ < "D" for download
  25. │ file1.dl                                    │ < batch downloads allowed
  26. │ another.zip                                 │
  27. │ filemore.lhz                                │
  28. │ --                                          │ < "--" is important
  29. │ u                                           │
  30. │ another.zip                                 │
  31. │ /Private to the sysop.  Thanks for the fish │
  32. │ --                                          │ < Esp. at the very end.
  33. └─────────────────────────────────────────────┘
  34.  
  35.   {:action}{sete-P0 esc}
  36.            {rope %_hom%action.%abbr,act-end}              <- START here
  37.   {:reread}{pops-c}
  38.            {setl 60,,10,|}
  39.            {read cmd}                         ;read line of ACTION file
  40.            {comp cmd,--}  {ifco reread}       ;branch to appropriate ACTION
  41.            {comp cmd,a}   {ifco asciup}
  42.            {comp cmd,j}   {ifco joincn}
  43.            {comp cmd,d}   {ifco dlfile}
  44.            {comp cmd,u}   {ifco ulfile}       ;if no match, end ACTION
  45.  
  46.   {:act-end}                                  ;When at end of ACTION list
  47.            {exec-n echo ^j*-*-* %_dat %_tim >> %savdir\used-act.%abbr}
  48.            {exec-n type %_hom%action.%abbr  >> %savdir\used-act.%abbr}
  49.            {exec-n del  %_hom%action.%abbr}
  50.            {setv line}  {setv fname}  {setv cmd}
  51.   {:esc}   {macl logon.mac,noact}                         <-  END here
  52.  
  53.   {:dlfile}{send %cmd%|}               ;Setup is for Zmodem BATCH downloads
  54.            {golo skip,not avai}        ;If host doesn't allow d/l, skip it
  55.   {:next-d}{read fname}                ;Read one complete line into %fname%
  56.            {inst fname,--} {ifco do-dl}
  57.            {ifex %dldir\%fname,next-d} ;Don't try to d/l files that exist
  58.            {send %fname%~~~|}          ;Send filename to BBS
  59.            {goto next-d}               ;Repeat read til dl-list is all read
  60.   {:do-dl} {send |~~|}                 ;Start download
  61.            {push}
  62.            {golo reread,%bbs_pmt}      ;if no filenames matched
  63.            {golo n|,ed? [}             ;Wildcat logoff after transfer
  64.            {golo z|,] ? [}             ;Wildcat protocol select
  65.            {look ^xB00}
  66.            {pops}
  67.            {exec-n %dszprog port %_por ha bo rz -mr %dldir}
  68.            {golo reread,] ? [}         ;At Wildcat File Menu
  69.            {look %bbs_pmt}
  70.            {goto reread}               ;end of "D" ACTION processor
  71.  
  72.   {:ulfile}{read fname}                ;Upload ACTION starts
  73.            {ifex %uldir\%fname,,skip}  ;Make sure file exists on your disk
  74.            {send u %fname% z|}         ;Tell host to get ready for u/l
  75.            {golo skip,Insufficient}    ; disk space for complete upload!
  76.            {golo skip,not avai}        ;If host doesn't allow u/l, or
  77.            {golo skip,y exists}        ;If host says file already exists,
  78.            {golo skip,plicates}        ;  skip this u/l action item.
  79.            {look ximum)}               ;Host is ready for description.
  80.    {:desc} {read line}
  81.            {comp line,--}              ;Check for end of u/l action
  82.            {ifco ul_ok}
  83.            {send ~%line%|}             ;Send description line
  84.            {goto desc}                 ;and look for more description
  85.   {:ul_ok} {send ~|}
  86.            {look ^xB01}                ;Zmodem upload
  87.            {exec-n %dszprog port %_por ha bo sz -m %uldir\%fname}
  88.            {setl 60,,30,|}             ;Allow time for file validation
  89.            {look %bbs_pmt}
  90.            {goto reread}               ;end of "U" ACTION processor
  91.  
  92.    {:skip} {read line}                 ;SKIP section jumps to next
  93.            {comp line,--}              ;  action item by reading to
  94.            {ifco ,skip}                ;  the next "--" string.
  95.            {send |}
  96.            {setl 50,,3,|}
  97.            {look %bbs_pmt}
  98.            {goto reread}               ;alternate end of "U" processor
  99.  
  100.   *  ASCII uploads take a special form.  Here is an example message.
  101.   *  You may need to structure ASCII upload messages differently.
  102.  
  103. ┌──────────────────────────────────  hijack ──┐
  104. │ jack kilday                                 │ < Message Recipient
  105. │ Thanks for the Fish                         │ < Message Subject
  106. │ n                                           │ < Public/Private msg flag
  107. │ u                                           │ < Use ASCII u/l, not editor
  108. │ Hi Jack,                                    │
  109. │                                             │
  110. │     Just stopping in with a test of a COMMO │
  111. │ ACTION macro processor.  I also wanted to   │
  112. │ give you a big THANK YOU for all the fish.  │
  113. │ They were delicious.                        │
  114. │                                             │
  115. │                                   Chuck·S   │
  116. └─────────────────────────────────────────────┘
  117.  
  118.   {:asciup}{read fname}                ;ASCII upload to PCBoard system
  119.            {ifex %dldir\%fname%,,reread}
  120.            {parm ,,,,2} {send e|}      ;Send "E" to start message entry
  121.            {asci %dldir\%fname%,}      ;Send the structured message
  122.            {parm ,,,,0} {send ~~|~~~sn|}   ;the PCBoard "save" command
  123.            {look %bbs_pmt}
  124.            {goto reread}               ;end of "A" processor
  125.  
  126.   {:joincn}{read fname}                ;Join PCBoard Conference
  127.            {send j %fname|}
  128.            {push}
  129.            {golo n|,)=yes?}            ;Skip mail scan
  130.            {golo |,invalid}            ;If you choose invalid conf
  131.            {golo n|,(H)elp}            ;If you chose invalid conf
  132.            {golo 0|,none?}             ;To conf 0 on invalid conf
  133.            {look %bbs_pmt}  {pops}
  134.            {goto reread}               ;end of "J" processor
  135.  
  136.     ┌───────────────────────────────────┐
  137. └───┤  End Of "ACTION processor" macro  ├───────
  138.     └───────────────────────────────────┘
  139.  
  140.     ┌─────────────────────────────┐
  141. ┌───┤  "ACTION generator"  macro  ├───
  142.     └─────────────────────────────┘
  143.  
  144.   *  One new feature in version CS-MAC06 ... now using PKUNZIP to
  145.   *  automatically insert the file description from a DESC.SDI or
  146.   *  a FILE_ID.DIZ that might be found in a ZIP file.
  147.  
  148.   *  This macro isn't commented.  It is pretty easy to follow.
  149.   *  Here it is assigned to the Alt-F key combination.
  150.  
  151.   {:alf}   {sete-p0 icmnd}
  152.            {inpu abbr,Make ^(ACTION^) file:  What BBS?}   <- START Here
  153.            {comp abbr}    {ifco opena}
  154.            {subs abbr,1,2,%abbr}
  155.   {:opena} {wope %_hom%action.%abbr}
  156.  
  157.   {:icmnd} {setv cmd} {setv fname} {setv line}
  158.            {inpu cmd,^(U^)pload, ^(D^)ownload, ^(A^)scii Upload, ^(J^)oin Conf?}
  159.            {comp cmd,u}   {ifco makeul}
  160.            {comp cmd,d}   {ifco makedl}
  161.            {comp cmd,a}   {ifco makeau}
  162.            {comp cmd,j}   {ifco makejn}
  163.            {comp cmd}     {ifco ,icmnd}
  164.            {wclo}         {edit %_hom%action.%abbr}
  165.            {setv cmd}     {setv fname} {setv line}
  166.            {macl commo.mac}                               <- END Here
  167.  
  168.   {:makejn}{inpu fname,Name or Number of Conference to Join}
  169.            {comp fname}   {ifco icmnd}
  170.            {writ j}
  171.            {writ %fname}
  172.            {writ --}      {goto icmnd}
  173.  
  174.   {:makeau}{inpu fname,Name the ASCII Upload}
  175.            {comp fname}   {ifco icmnd}
  176.            {ifex %dldir\%fname,,makeau}
  177.            {writ a}
  178.            {writ %fname}
  179.            {writ --}      {goto icmnd}
  180.  
  181.   {:makedl}{setv fname}   {setv count,1}
  182.            {inpu fname,Name a File that you want to DownLoad}
  183.            {comp fname}   {ifco icmnd}
  184.            {writ d}
  185.   {:dlmore}{writ %fname}
  186.            {incr count}   {setv fname}
  187.            {inpu fname,File #%count% to Download?}
  188.            {comp fname}   {ifco ,dlmore}
  189.            {writ --}      {goto icmnd}
  190.  
  191.   {:makeul}{inpu fname,Name the file to upload}
  192.            {comp fname}   {ifco icmnd}
  193.            {ifex %dldir\%fname,descul,makeul}
  194.   {:descul}{exec-d %pk_un -v %dldir\%fname desc.sdi file_id.diz}
  195.            {ifer 1,,diz_dsc}
  196.            {setv count,1}
  197.            {setv line}
  198.            {inpu line,One line description of %fname% Required}
  199.            {comp line}    {ifco icmnd}
  200.            {writ u}       {write %fname}
  201.            {writ %line}   {incr count}
  202.   {:mdesc} {setv line}    {inpu line,Line %count% of %fname% description}
  203.            {comp line}    {ifco endul}
  204.            {writ %line}   {incr count}
  205.            {goto mdesc}
  206.   {:endul} {writ --}      {goto icmnd}
  207.  
  208. {:diz_dsc} {writ u}       {write %fname}
  209.            {setv file,file_id.diz}
  210. {:add_dsc} {exec-d %pk_un -v %uldir\%fname %file}
  211.            {ifer 1,chk_sdi}
  212.            {exec-n %pk_un -o %uldir\%fname %ramdr\ %file}
  213.            {rope %ramdr\%file,endul}
  214.  {:diz_lp} {read line}
  215.            {writ %line}
  216.            {goto diz_lp}
  217. {:chk_sdi} {setv file,desc.sdi}
  218.            {goto add_dsc}
  219.  
  220.     ┌───────────────────────────────────┐
  221. └───┤  End Of "ACTION generator" macro  ├───────
  222.     └───────────────────────────────────┘
  223.